package com.study.example.gameserver.serverinfo.entity;

import com.sparrow.cache.annotation.Cache;
import com.sparrow.cache.annotation.CacheType;
import com.sparrow.cache.entity.AbstractEntity;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

@Entity
@Table(name = "ServerInfo")
@IdClass(ServerInfoId.class)
@Cache(cacheType = CacheType.STRONG)
public class ServerInfo extends AbstractEntity<ServerInfoId> {
    @Id
    private Integer serverId;
    @Id
    private String infoKey;

    private String value;

    @Override
    public ServerInfoId getPK() {
        return new ServerInfoId(serverId, infoKey);
    }

    @Override
    public long dispatchCode() {
        return serverId.longValue();
    }

    public Integer getServerId() {
        return serverId;
    }

    public void setServerId(Integer serverId) {
        this.serverId = serverId;
    }

    public String getInfoKey() {
        return infoKey;
    }

    public void setInfoKey(String infoKey) {
        this.infoKey = infoKey;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}

